Skip to content
main
Switch branches/tags
jam0001/DJs/
jam0001/DJs/

Latest commit

Co-authored-by: Krayorn <nathael.arki@golem.ai>
57d52e8

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
Aug 22, 2021
Aug 22, 2021
src
Aug 22, 2021
Aug 22, 2021
Aug 22, 2021
Aug 22, 2021

DJs

DJs is an interpreter that works on JS files and add sound effects based on comments configuration.

Prerequisites

  • You'll need to have node installed.

  • You'll need to install the SoX library:

sudo apt-get install sox

Or download its binary on SoX source forge.

Usage

DJS is usable on any single .js file. It will execute the file normally, and if the file contains DJS comment will play a melody during the execution.

To test the program with one of our example you can run the following .sh :

If you have sox in your path

./nodjs examples/example.js

If you have no instance of sox in your path, just specify the path too the binary

./nodjs examples/example.js ./lib/sox

How the comments work

Comments should be placed before a function that must be defined with the syntax function name() {. The comments can contains multiples lines. There is multiple kinds of effects available to configure the DJS program.

@var

When using the tag var, the following argument must be the name of a variable. After the variable, the following args goes in pair of two, one note, and the octave of the desired note.

@var [variable] [note] [octave]

Multiple notes can be mapped to the same variable to create chords.

@var bar mi 3
@var foo re 4 do 2

The available notes are C, C#, D, E#, E, F, G#, G, A#, A, B#, B, do, reB, re, miB, mi, fa, solB, sol, laB, la, siB, si and silence (for a pause)

When encountered in the function, each variable will then play the note or chord that was configured. If multiple variable are on the same line, they'll be played in the order seen from left ro right.

The duration of the note is defined by the value of the variable.

For arrays and strings, it depends on the length of the variable %6 For integers, the value of the variable %6

The smallest the value, the fastest the note / chord.

@waveType

When using the tag waveType, only one argument is needed to indicate the type of wave used to make the sound. It can be one of the following: sine, square, triangle, sawtooth, trapezium, exp, [white]noise, tpdfnoise, pinknoise, brownnoise, pluck, sine. If no wavetype is precised, sine will be used.